import React from 'react'
import { useDispatch, useSelector } from 'react-redux';
import { delIterm } from '@/store/modules/modules'
//导入css 
import '@/pages/Home/css/EditorWrapper/ContextMenu.scss'
import { resolve } from 'path';
export default function ContextMenu() {
    //获取是否显示右键组件得状态
    const showMenu = useSelector((state: any) => state.reducer.showMenu);
    const menuLfet = useSelector((state: any) => state.reducer.menuLfet);
    const menuTop = useSelector((state: any) => state.reducer.menuTop);
    const dispatch = useDispatch();

    //删除组件
    const delmenu = () => {
        //派发
        dispatch(delIterm())
    }
    if (showMenu) {
        var content: any = <ul>
            <li onClick={delmenu}>删除</li>
        </ul>
    }
    return (
        <div className='contextmenu' style={{ left: menuLfet + 'px', top: menuTop + 'px' }}>
            {content}
            
        </div>
    )
}


